package hotciv.winningstrategies;

import hotciv.framework.GameContext;
import hotciv.framework.Player;
import hotciv.framework.WinningStrategy;

public class ThreeWinsWinningStrategy implements WinningStrategy
{
	private int winningCounterRed=0;
	private int winningCounterBlue=0;
	
	public Player getWinner(GameContext g)
	{
		if(g.fightJustWon())
		{
			switch(g.getPlayerInTurn())
			{
				case RED : winningCounterRed++; 
					break;
				case BLUE : winningCounterBlue++;
					break;
			}
		}
		
		if(winningCounterRed > 2)
		{
			return Player.RED;
		}
		if(winningCounterBlue > 2)
		{
			return Player.BLUE;
		}
		return null;
	}
}
